package org.onosproject.ngsdn.tutorial.cli;

import com.google.common.collect.ImmutableList;
import org.apache.karaf.shell.api.action.Argument;
import org.apache.karaf.shell.api.action.Command;
import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.ngsdn.tutorial.RouterComponent;

import java.util.List;
import java.util.Locale;


@Service
@Command(scope = "onos", name = "switchmodal",
        description = "Change modal")
public class ModalChangeCommand extends AbstractShellCommand {
    @Argument(index = 0, name = "uri", description = "Modal Name (MF | GEO | NDN)",
            required = true, multiValued = false)
    String uri = null;

    @Override
    protected void doExecute() {
        List<String> modalList = ImmutableList.of("MF", "GEO", "NDN");
        if (modalList.contains(uri.toUpperCase())) {
            RouterComponent app = get(RouterComponent.class);
            app.switchModal(uri);
        } else {
            print("The modal {} is not support!", uri);
        }

    }
}
